Subj: WM_DEVMODECHANGE? Section: Visual Basic From: Wilson Smith 76702,1416 # 49017, 1 Reply To: All Date: 10-Jul-92 12:31:14 How can my program tell if the default printer has changed? I've been trying to intercept WM_DEVMODECHANGE messages (the way that Jonathan Zuck's recent WinTech journal article intercepts WM_DROPFILES messages), but haven't been having any luck. Is there an easier way? What I'm trying to do is modify a menu of fonts when the available fonts change... Thanks. -------------------------------------------------------------------------- Subj: WM_DEVMODECHANGE? Section: Visual Basic From: Wilson Smith 76702,1416 # 49216, * No Replies * To: Wilson Smith 76702,1416 Date: 11-Jul-92 14:21:13 Not sure if anybody's interested in this prob or not, but it looks like WM_DEVMODECHANGE and WM_WININICHANGE messages don't go into the message queue and therefore can't be examined with PeekMessage... These messages are apparently sent directly to VB which ignores them. I wound up writing a tiny DLL in TP for Windows that installs a window-procedure filter which monitors messages sent to the application. The DLL sets a flag if it sees any of the messages I'm interested in. My program is meanwhile checking this flag in a DoEvents loop. Seems like the long way around, but I couldn't figure any other way to do it... I'll upload the gory details in case anyone's curious or trying to tackle a similar problem. Filename FILTER.ZIP. ----------------------------------------------------------------------------- MESSRECD.PAS Turbo Pascal for Windows source code for a small DLL that installs a windows-procedure filter when it is loaded and sets a flag when a WM_DEVMODECHANGE or WM_WININICHANGE message is intercepted. The DLL contains a function which checks the value of this flag. MESSRECD.DLL Compiled DLL. MESSRECD.MAK Visual basic demo project showing usage of the DLL. MESSRECD.FRM Main form of the project. MESSMAIN.BAS The demo program's MAIN loop.